開始對TiDB進行測試,測試環境如下:
服務|vcpu|ram|數量
------------- |-------------
TIDB/PD | 8 | 20G | 3
KV | 16 |30G| 3
TIUP | 2 | 7.5G |1
首先將go-ycsb安裝在Tiup機器上。測試情境為預定執行worklaoda(讀/寫各50%)的腳本,
設定使用512個threads共寫入一百萬筆資料,預期測試過程能達到8000的ops。
過程中會建立一個名稱為test的database,以及名稱為usertable的表。
首先執行load將需要的資料先寫入。
/root/go-ycsb/src/github.com/pingcap/go-ycsb/bin/go-ycsb load tikv \
-P /root/go-ycsb/src/github.com/pingcap/go-ycsb/workloads/workloada \
-p dropdata=true -p verbose=false -p debug.pprof=":6060" \
-p tikv.pd="10.102.1.92:2379,10.102.1.195:2379,10.102.1.196:2379" -p tikv.type="raw" \
-p tikv.conncount=128 -p tikv.batchsize=128 \
-p operationcount=1000000 -p recordcount=1000000 \
-p target=8000 \
-p measurement.interval=both \
-p threadcount=512
可以看到執行的結果
INSERT - Takes(s): 9.9, Count: 79867, OPS: 8043.2, Avg(us): 17906, Min(us): 4707, Max(us): 139951, 99th(us): 88000, 99.9th(us): 122000, 99.99th(us): 137000
INSERT - Takes(s): 19.9, Count: 159797, OPS: 8017.9, Avg(us): 15916, Min(us): 4371, Max(us): 139951, 99th(us): 69000, 99.9th(us): 117000, 99.99th(us): 137000
INSERT - Takes(s): 29.9, Count: 239854, OPS: 8013.8, Avg(us): 16997, Min(us): 4131, Max(us): 169660, 99th(us): 80000, 99.9th(us): 126000, 99.99th(us): 164000
INSERT - Takes(s): 39.9, Count: 319812, OPS: 8009.3, Avg(us): 16984, Min(us): 4131, Max(us): 209651, 99th(us): 79000, 99.9th(us): 165000, 99.99th(us): 202000
INSERT - Takes(s): 49.9, Count: 399828, OPS: 8007.6, Avg(us): 16483, Min(us): 4131, Max(us): 209651, 99th(us): 76000, 99.9th(us): 157000, 99.99th(us): 198000
INSERT - Takes(s): 59.9, Count: 423532, OPS: 7067.1, Avg(us): 24380, Min(us): 4131, Max(us): 1646857, 99th(us): 131000, 99.9th(us): 1582000, 99.99th(us): 1645000
INSERT - Takes(s): 69.9, Count: 439340, OPS: 6282.2, Avg(us): 36076, Min(us): 4131, Max(us): 1803759, 99th(us): 695000, 99.9th(us): 1646000, 99.99th(us): 1782000
INSERT - Takes(s): 79.9, Count: 475564, OPS: 5949.6, Avg(us): 44163, Min(us): 4131, Max(us): 1803759, 99th(us): 664000, 99.9th(us): 1647000, 99.99th(us): 1782000
INSERT - Takes(s): 89.9, Count: 530075, OPS: 5894.3, Avg(us): 49273, Min(us): 4131, Max(us): 3084722, 99th(us): 706000, 99.9th(us): 1793000, 99.99th(us): 3080000
INSERT - Takes(s): 99.9, Count: 582149, OPS: 5825.6, Avg(us): 53661, Min(us): 4131, Max(us): 3084722, 99th(us): 812000, 99.9th(us): 2956000, 99.99th(us): 3080000
INSERT - Takes(s): 109.9, Count: 637588, OPS: 5799.9, Avg(us): 57025, Min(us): 4131, Max(us): 3084722, 99th(us): 953000, 99.9th(us): 2953000, 99.99th(us): 3080000
INSERT - Takes(s): 119.9, Count: 652672, OPS: 5442.1, Avg(us): 63337, Min(us): 4131, Max(us): 3084722, 99th(us): 1044000, 99.9th(us): 2952000, 99.99th(us): 3080000
INSERT - Takes(s): 129.9, Count: 737711, OPS: 5677.8, Avg(us): 62568, Min(us): 4131, Max(us): 3084722, 99th(us): 975000, 99.9th(us): 2947000, 99.99th(us): 3079000
INSERT - Takes(s): 139.9, Count: 767951, OPS: 5488.1, Avg(us): 66479, Min(us): 4131, Max(us): 3084722, 99th(us): 1055000, 99.9th(us): 2945000, 99.99th(us): 3079000
INSERT - Takes(s): 149.9, Count: 853055, OPS: 5689.6, Avg(us): 66568, Min(us): 4131, Max(us): 3084722, 99th(us): 1049000, 99.9th(us): 2941000, 99.99th(us): 3078000
INSERT - Takes(s): 159.9, Count: 860675, OPS: 5381.6, Avg(us): 71572, Min(us): 4131, Max(us): 3084722, 99th(us): 1072000, 99.9th(us): 2941000, 99.99th(us): 3078000
INSERT - Takes(s): 169.9, Count: 870508, OPS: 5122.7, Avg(us): 76921, Min(us): 4131, Max(us): 3084722, 99th(us): 1069000, 99.9th(us): 2940000, 99.99th(us): 3078000
INSERT - Takes(s): 179.9, Count: 880418, OPS: 4893.1, Avg(us): 81865, Min(us): 4131, Max(us): 3084722, 99th(us): 1067000, 99.9th(us): 2940000, 99.99th(us): 3078000
INSERT - Takes(s): 189.9, Count: 886584, OPS: 4667.9, Avg(us): 86750, Min(us): 4131, Max(us): 3084722, 99th(us): 1108000, 99.9th(us): 2939000, 99.99th(us): 3078000
INSERT - Takes(s): 199.9, Count: 907798, OPS: 4540.5, Avg(us): 90775, Min(us): 4131, Max(us): 3084722, 99th(us): 1096000, 99.9th(us): 2937000, 99.99th(us): 3078000
INSERT - Takes(s): 209.9, Count: 937016, OPS: 4463.5, Avg(us): 93384, Min(us): 4131, Max(us): 3084722, 99th(us): 1082000, 99.9th(us): 2934000, 99.99th(us): 3078000
INSERT - Takes(s): 219.9, Count: 968914, OPS: 4405.5, Avg(us): 94626, Min(us): 4131, Max(us): 3084722, 99th(us): 1078000, 99.9th(us): 2933000, 99.99th(us): 3078000
Run finished, takes 3m44.937041091s
INSERT - Takes(s): 224.9, Count: 999936, OPS: 4446.8, Avg(us): 95044, Min(us): 4131, Max(us): 3819982, 99th(us): 1087000, 99.9th(us): 2948000, 99.99th(us): 3810000
共花費3分鐘56秒完成寫入,OPS是4446.8,平均的latency是95044微秒。
接著開始依照腳本執行run
/root/go-ycsb/src/github.com/pingcap/go-ycsb/bin/go-ycsb run tikv \
-P /root/go-ycsb/src/github.com/pingcap/go-ycsb/workloads/workloada \
-p dropdata=false -p verbose=false -p debug.pprof=":6060" \
-p tikv.pd="10.102.1.92:2379,10.102.1.195:2379,10.102.1.196:2379" -p tikv.type="raw" \
-p tikv.conncount=128 -p tikv.batchsize=128 \
-p operationcount=1000000 -p recordcount=1000000 \
-p target=8000 \
-p measurement.interval=both \
-p threadcount=512
執行結果如下
READ - Takes(s): 9.9, Count: 39857, OPS: 4033.8, Avg(us): 4327, Min(us): 271, Max(us): 188343, 99th(us): 37000, 99.9th(us): 156000, 99.99th(us): 185000
UPDATE - Takes(s): 9.9, Count: 39917, OPS: 4042.7, Avg(us): 21747, Min(us): 6531, Max(us): 227981, 99th(us): 59000, 99.9th(us): 190000, 99.99th(us): 224000
READ - Takes(s): 19.9, Count: 79870, OPS: 4019.4, Avg(us): 3935, Min(us): 232, Max(us): 188343, 99th(us): 33000, 99.9th(us): 130000, 99.99th(us): 180000
UPDATE - Takes(s): 19.9, Count: 79967, OPS: 4025.8, Avg(us): 21487, Min(us): 6531, Max(us): 227981, 99th(us): 58000, 99.9th(us): 173000, 99.99th(us): 217000
READ - Takes(s): 29.9, Count: 119779, OPS: 4009.8, Avg(us): 3644, Min(us): 232, Max(us): 188343, 99th(us): 31000, 99.9th(us): 113000, 99.99th(us): 176000
UPDATE - Takes(s): 29.9, Count: 120028, OPS: 4019.1, Avg(us): 21813, Min(us): 6531, Max(us): 227981, 99th(us): 58000, 99.9th(us): 167000, 99.99th(us): 212000
READ - Takes(s): 39.9, Count: 159781, OPS: 4007.3, Avg(us): 3414, Min(us): 232, Max(us): 188343, 99th(us): 30000, 99.9th(us): 94000, 99.99th(us): 175000
UPDATE - Takes(s): 39.9, Count: 160002, OPS: 4013.5, Avg(us): 21183, Min(us): 5751, Max(us): 227981, 99th(us): 55000, 99.9th(us): 161000, 99.99th(us): 210000
READ - Takes(s): 49.9, Count: 199945, OPS: 4009.2, Avg(us): 3353, Min(us): 232, Max(us): 188343, 99th(us): 30000, 99.9th(us): 80000, 99.99th(us): 173000
UPDATE - Takes(s): 49.9, Count: 199810, OPS: 4007.1, Avg(us): 20900, Min(us): 5751, Max(us): 227981, 99th(us): 55000, 99.9th(us): 153000, 99.99th(us): 209000
READ - Takes(s): 59.9, Count: 239798, OPS: 4005.2, Avg(us): 3320, Min(us): 232, Max(us): 188343, 99th(us): 30000, 99.9th(us): 74000, 99.99th(us): 173000
UPDATE - Takes(s): 59.9, Count: 240034, OPS: 4009.6, Avg(us): 21347, Min(us): 5118, Max(us): 227981, 99th(us): 66000, 99.9th(us): 164000, 99.99th(us): 207000
READ - Takes(s): 69.9, Count: 279871, OPS: 4005.5, Avg(us): 3294, Min(us): 232, Max(us): 188343, 99th(us): 29000, 99.9th(us): 70000, 99.99th(us): 159000
UPDATE - Takes(s): 69.9, Count: 279926, OPS: 4006.7, Avg(us): 21161, Min(us): 5118, Max(us): 227981, 99th(us): 62000, 99.9th(us): 160000, 99.99th(us): 205000
READ - Takes(s): 79.9, Count: 319631, OPS: 4001.8, Avg(us): 3263, Min(us): 232, Max(us): 188343, 99th(us): 29000, 99.9th(us): 67000, 99.99th(us): 157000
UPDATE - Takes(s): 79.9, Count: 320163, OPS: 4008.8, Avg(us): 21180, Min(us): 5118, Max(us): 227981, 99th(us): 60000, 99.9th(us): 157000, 99.99th(us): 202000
READ - Takes(s): 89.9, Count: 359496, OPS: 3999.8, Avg(us): 3255, Min(us): 232, Max(us): 188343, 99th(us): 30000, 99.9th(us): 68000, 99.99th(us): 157000
UPDATE - Takes(s): 89.9, Count: 360396, OPS: 4010.1, Avg(us): 21543, Min(us): 5118, Max(us): 227981, 99th(us): 65000, 99.9th(us): 157000, 99.99th(us): 197000
READ - Takes(s): 100.0, Count: 399249, OPS: 3994.3, Avg(us): 3266, Min(us): 232, Max(us): 188343, 99th(us): 30000, 99.9th(us): 61000, 99.99th(us): 130000
UPDATE - Takes(s): 99.9, Count: 400540, OPS: 4007.5, Avg(us): 21671, Min(us): 5118, Max(us): 227981, 99th(us): 64000, 99.9th(us): 155000, 99.99th(us): 196000
READ - Takes(s): 109.9, Count: 439341, OPS: 3998.6, Avg(us): 3287, Min(us): 232, Max(us): 188343, 99th(us): 30000, 99.9th(us): 68000, 99.99th(us): 155000
UPDATE - Takes(s): 109.9, Count: 440484, OPS: 4009.2, Avg(us): 21830, Min(us): 5118, Max(us): 227981, 99th(us): 63000, 99.9th(us): 151000, 99.99th(us): 195000
READ - Takes(s): 119.9, Count: 479167, OPS: 3997.3, Avg(us): 3325, Min(us): 232, Max(us): 188343, 99th(us): 30000, 99.9th(us): 67000, 99.99th(us): 129000
UPDATE - Takes(s): 119.9, Count: 480630, OPS: 4009.7, Avg(us): 22215, Min(us): 5118, Max(us): 275235, 99th(us): 71000, 99.9th(us): 159000, 99.99th(us): 217000
Run finished, takes 2m5.104041064s
READ - Takes(s): 125.0, Count: 499119, OPS: 3993.8, Avg(us): 3304, Min(us): 232, Max(us): 188343, 99th(us): 30000, 99.9th(us): 68000, 99.99th(us): 151000
UPDATE - Takes(s): 125.0, Count: 500817, OPS: 4007.6, Avg(us): 22118, Min(us): 5118, Max(us): 275235, 99th(us): 70000, 99.9th(us): 158000, 99.99th(us): 217000
共花費2分鐘5秒完成寫入,讀的OPS是3993.8,平均的latency是3304微秒。更新的部分OPS為4007.6,latency平均為22118微秒。